import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "Home",
    component: () => import("@/views/Home")
  },
  {
    path: "/login",
    name: "login",
    component: () => import("@/views/login/index")
  },
  {
    path: "/backend",
    name: "backend-home",
    component: () => import("@/views/backend/Home"),
    children: [
      {
        path: "manufacturer",
        name: "manufacturer",
        component: () => import("@/views/backend/manufacturer/index.vue")
      },
      {
        path: "manufacturer_add",
        name: "manufacturer-add",
        component: () => import("@/views/backend/manufacturer/add_manufacturer/index.vue")
      },
      {
        path: "switch",
        name: "keyswitch",
        component: () => import("@/views/backend/keyswitch/index.vue")
      },
      {
        path: "edit-switch/:id",
        name: "edit-switch",
        component: () => import("@/views/backend/keyswitch/edit_switch/index.vue")
      },
      {
        path: "add-switch",
        name: "add-switch",
        component: () => import("@/views/backend/keyswitch/add_switch/index.vue")
      },
      {
        path: "tester",
        name: "tester",
        component: () => import("@/views/backend/tester/index.vue")
      },
      {
        path: "config-tester/:id",
        name: "config-tester",
        component: () => import("@/views/backend/tester/config-tester/index.vue")
      },
      {
        path: "view-tester/:id",
        name: "view-tester",
        component: () => import("@/views/backend/tester/view-tester/index.vue")
      },
      {
        path: "store-switch",
        name: "store-switch",
        component: () => import("@/views/backend/store_switch/index.vue")
      },
      {
        path: "keyboard",
        name: "keyboard",
        component: () => import("@/views/backend/keyboard/index.vue")
      },
      {
        path: "keyboard-edit/:id",
        name: "keyboard-edit",
        component: () => import("@/views/backend/keyboard/edit-keyboard/index.vue")
      },
      {
        path: "keyboard-view/:id",
        name: "keyboard-view",
        component: () => import("@/views/backend/keyboard/view-keyboard/index.vue")
      },
    ]
  }
];

const router = new VueRouter({
  base: process.env.BASE_URL,
  routes
});

export default router;
